package com.sjq.demo.mapper;

import com.sjq.demo.entity.RbacRole;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 角色表 Mapper 接口
 * </p>
 *
 * @author yer
 * @since 2021-02-26
 */
public interface RbacRoleMapper extends BaseMapper<RbacRole> {

    /**
     * 通过用户信息获取角色信息
     * @param userid
     * @return
     */
    @Select("select * from t_rbac_role where id in (select roleid from t_rbac_user_role where userid=#{userid})")
    List<RbacRole> getRolesByUserId(@Param("userid") String userid);
}
